package BinaryTree;
/**
 * 二叉搜索树中的搜索
 */
import BinaryTree.init.TreeNode;

public class lc700 {

    public TreeNode searchBST(TreeNode root, int val) {
        if (root == null || root.val == val) return root;
        TreeNode result = null;
        if (root.val > val) {
            result = searchBST(root.left, val);
        }
        if (root.val < val) {
            result = searchBST(root.right, val);
        }
        return result;
    }

}
